package Text3;

public class Main {

    public static void instersort(int[] arr){
        if(arr==null){
            return;
        }
        for (int i = 1; i <arr.length ; i++) {
            int j=i-1;
            int tmp=arr[i];
            for (;j>=0 ;j--) {
                if(arr[j]>tmp){
                    arr[j+1]=arr[j];
                }else{
                    break;
                }
            }
            arr[j+1]=tmp;
        }
    }

    public static void main(String[] args) {
        int[] arr = { 3,2,6,11,0,8,7,44 };
        instersort(arr);
        for (int i = 0; i <arr.length; i++)
        {
            System.out.print(arr[i]+" ");
        }
    }
}
